/*
 * =====================================================================================
 *
 *       Filename:  1st.cpp
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  02/14/2011 05:50:44 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  dp (8023), dp8023@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */

#include <iostream>

using namespace std;

class foodproduct
{
	public:
		foodproduct(){}
		virtual ~foodproduct(){}

		virtual void delicious(){}
};

class braisingfish:public foodproduct
{
	public:
		braisingfish(){}
		~braisingfish(){}

		virtual void delicious(){}
};

class steamedfish:public foodproduct
{
	public:
		steamedfish(){}
		~steamedfish(){}

		virtual void delicious(){}
};

class chuanbraisingfish:public braisingfish
{
	public:
		chuanbraisingfish(){}
		~chuanbraisingfish(){}

		virtual void delicious(){}
};

class chuansteamedfish:public steamedfish
{
	public:
		chuansteamedfish(){}
		~chuansteamedfish(){}

		virtual void delicious(){}
};

class lubraisingfish:public braisingfish
{
	public:
		lubraisingfish(){}
		~lubraisingfish(){}

		virtual void delicious(){}
};

class lusteamedfish:public steamedfish
{
	public:
		lusteamedfish(){}
		~lusteamedfish(){}

		virtual void delicious(){}
};

class cookfactory
{
	public:
		cookfactory(){}
		virtual ~cookfactory(){}
		virtual braisingfish *cookbraisingfish() = 0;
		virtual steamedfish *cooksteamedfish() = 0;
};

class lucookfactory:public cookfactory
{
	public:
		lucookfactory(){}
		~lucookfactory(){}

		braisingfish *cookbraisingfish()
		{
			cout << "The lu braisingfish is cooked!" << endl;
			return new lubraisingfish();
		}
		steamedfish *cooksteamedfish()
		{
			cout << "The lu steamedfish is cooked!" << endl;
			return new lusteamedfish();
		}
};

class chuancookfactory:public cookfactory
{
	public:
		chuancookfactory(){}
		~chuancookfactory(){}

		braisingfish *cookbraisingfish()
		{
			cout << "The chuan braisingfish is cooked!" << endl;
			return new chuanbraisingfish();
		}
		steamedfish *cooksteamedfish()
		{
			cout << "The chuan steamedfish is cooked!" << endl;
			return new chuansteamedfish();
		}
};

int main()
{
	cookfactory *pcookfactory = new lucookfactory();
	braisingfish *pbraisingfish = pcookfactory->cookbraisingfish();

	pbraisingfish->delicious();
	delete pbraisingfish;
	cout << "***************************\n" << endl;

	steamedfish *psteamdfish = pcookfactory->cooksteamedfish();

	psteamdfish->delicious();
	delete psteamdfish;
	cout << "***************************\n" << endl;

	delete pcookfactory;

	pcookfactory = new chuancookfactory();

	pbraisingfish = pcookfactory->cookbraisingfish();

	pbraisingfish->delicious();
	delete pbraisingfish;
	cout << "***************************\n" << endl;

	psteamdfish = pcookfactory->cooksteamedfish();
	psteamdfish->delicious();
	delete psteamdfish;
	cout << "***************************\n" << endl;

	delete pcookfactory;

	return 0;
}

